<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>部门</title>
<script type="text/javascript">

//初始化checkbox
jQuery("document").ready(function(){
	jQuery("#all").click(function(){
			var flag = document.getElementById("all").checked;
	   	 	jQuery("[name=selId]:checkbox").each(function() {
	        		jQuery(this).attr("checked", flag);
	   		});
   });
	
	 $("#Pagination").paginate({
			count 		: '${count}',	//页数
			start 		: '${currentPageNo}',
			display     : 10,
			border					: true,
			border_color			: '#BEF8B8',
			text_color  			: '#68BA64',
			background_color    	: '#CAE8EA',	
			border_hover_color		: '#68BA64',
			text_hover_color  		: 'black',
			background_hover_color	: '#CAE8EA', 
			rotate      : false,
			images		: false,
			mouse		: 'press',
			onChange     			: function(page){
				var id = '${deptId}';
				$.ajax( {
	    			type : 'GET',
	    			url :"${pageContext.request.contextPath}/ufmDept/ajaxGetTree?parentId="+id+"&currentPageNo="+page+"&currentPageNo="+"${currentPageNo}",
	    			cache : false,
	    			async:false,
	    			error : function(XMLHttpRequest, textStatus, errorThrown) {
	    				//alert(XMLHttpRequest.readyState);
	    			},
	    			success : function(data) {
	    				$("#resultList").empty();
	    				$("#resultList").html(data);
	    			}
	    		}); 
									  }
		});
	 
	 if($.inArray("部门维护_删除", allRights)>=0){
		   $("#delete").show();
		   $("a[name='delete1']").show();
	   }
	   if($.inArray("部门维护_新增", allRights)>=0){
		   $("#add").show();
	   }
	   if($.inArray("部门维护_修改", allRights)>=0){
		   $("a[name='edit']").show();
	   }
	   if($.inArray("部门维护_查询", allRights)>=0){
		   $("#search").show();
	   }
});
</script>
</head>

<body>
<table id="mytable" cellspacing="0" summary="The technical specifications of the Apple PowerMac G5 series">  
   <tr>
  	<th><input type="checkbox" id="all" name="all"/></th> 
    <th>序号</th> 
    <th>编号</th> 
    <th>名称</th>
    <th>简码</th>   
    <th>顺序号</th>
    <th>级别</th>
    <th>联系人</th>
    <th>联系电话</th>
    <th>创建人</th>
    <th>创建时间</th>
    <th>操作</th> 
  </tr> 
  <c:forEach items="${dept}" var="d" varStatus="i">
  <tr> 
  		<td align="center"><input type="checkbox" id="selId" name="selId" value="${d.m1}"/></td> 
	   	<td>${i.index+1}</td>
	   	<td>${d.m1}</td>	
	    <td>${d.m3}</td>
	    <td>${d.p11}</td> 
	    <td>${d.p12}</td>
	    <td>${d.z4}</td> 
	    <td>${d.m9}</td>	    
	    <td>${d.m10}</td> 
	    <td>${d.p13}</td> 
	    <td><fmt:formatDate value ="${d.p14}" type="date" pattern="yyyy-MM-dd HH:mm:ss"/> </td>
	    <td><a name="delete1" style="display: none" href="javascript:void(0)" onclick = "deleteById('${d.m1}')">删除</a>
	    	<a name="edit" style="display: none" href="javascript:void(0)" onclick="toUpdatePage('${d.m1}')">修改</a></td>
  	</tr> 
  </c:forEach>  
</table>
<div id="Pagination" ></div> 
</body>
</html>
